class Solution:
    """
    554. 砖墙
    https://leetcode-cn.com/problems/brick-wall/
    @date 2021年1月15日15:31:55
    @author mizzle rain 
    """
    def leastBricks(self, wall):
        dict1 = dict()
        res = 0
        for item in wall:
            s = 0
            for i in range(0, len(item) - 1):
                s += item[i]
                dict1[s] = dict1[s] + 1 if s in dict1 else 1
                res = max(res, dict1[s])
        return len(wall) - res
